import api from '../../stream/index';
import myStream from '../../stream/Stream';
// import mockData from '../../mock_data';

const modal = weex.requireModule('modal');
export default {
  state: {
    tabsData: [],
    data: []
  },
  mutations: {
    setData(state, data) {
      state.data = data;
    },
  },
  actions: {
    getCategory({
      state,
      commit,
      rootState
    }, option) {
      return new Promise((resolve, reject) => {
        api.category.post(option).then((data) => {
          commit('setData', data.data);
          resolve(data.data.tabs);
        }, (error) => {
          console.log(error);
          reject(data.data);
        });
      });
    }
  }
};